package com.xihu.credit.service;

import com.xihu.credit.entity.UserAuth;
import com.xihu.credit.mapper.UserAuthMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class UserAuthService {

    @Autowired
    private UserAuthMapper userAuthMapper;

    /**
     * 提交用户实名认证信息
     * @param userAuth 用户认证信息
     * @return 结果
     */
    public Map<String, Object> submitAuth(UserAuth userAuth) {
        Map<String, Object> result = new HashMap<>();
        try {
            // 保存用户认证信息
            userAuthMapper.insertUserAuth(userAuth);
            result.put("status", "success");
            result.put("message", "实名认证成功");
        } catch (Exception e) {
            result.put("status", "error");
            result.put("message", "实名认证失败，请稍后再试");
        }
        return result;
    }
}
